<?php include 'frame-top.php'; ?>

<?php $cid=$this->course['CId']; ?>
<?php $edit = auth::check(auth::EDIT_LAB_STUFF); ?>

<!-- course name  -->
<div class="segm" style="border-bottom:1px solid #ccc;">
	<h2><?=$this->course['Name']?> &nbsp; 
		<?=$edit?'<input type="button" value="edit"
					onclick="edit_course('.$cid.')" />
				  <input type="button" value="del"
					onclick="del_course('.$cid.')" />':''?>
	</h2>
</div>

<!-- course info -->
<div class="segm"> <a name="compiler"></a>

	<table class="edu">

	<tr><td width="13%">课程名称：</td>
		<td width="87%">
			<?=$this->course['Name']?></td>
	</tr>
	<tr><td>英文名称：</td>
		<td><?=$this->course['EnglishName']?></td>
	</tr>
	<tr><td>学　　时：</td>
		<td><?=$this->course['ClassHour']?></td>
	</tr>
	<tr><td>时间地点：</td>
		<td><?=$this->course['TimePlace']?></td>
	</tr>

	<tr><td colspan="2" style="padding:10px 0px;">
		<?= $this->course['Intro']?></td>
	</tr>

	<tr><td>任课教师：</td>
		<td><?php foreach ($this->teacher as $t) : ?>
			<div class="teacher">
				<a href="/member/info/AId/<?=$t['AId']?>"><img src="/pub/icon/<?=$t['Icon']?>" /></a>
				<p><a href="/member/info/AId/<?=$t['AId']?>"><?=$t['Name']?></a></p>
			</div>
			<?php endforeach; ?>
		</td>
	</tr>

	<tr><td>教　　材：</td>
		<td><?=$this->course['Book']?></td>
	</tr>
	<tr><td>考核方法：</td>
		<td><?=$this->course['Exam']?></td>
	</tr>
	<tr><td>参考资料：</td>
		<td><?=$this->course['Reference']?></td>
	</tr>

	<tr><td>课　　件：</td>
		<td><?= $edit?'<p><input type="button" value="add courseware" 
						onclick="add_courseware('.$cid.');"></p>':''; ?>
			<?php foreach ($this->ware as $cw) : 
					$date = strftime("%Y-%m-%d", $cw['Date']); ?>
			<p><a href="/pub/courseware/<?=$cw['File']?>" 
				  target="_blank"><?=$cw['Name']?></a>
				/ <?=$date?> / <?=$cw['Uploader']?>
				<?=$edit?'/ <input type="button" value="del"
						onclick="del_courseware('.$cw['WId'].')" />':'';?>
			</p>
			<?php endforeach; ?>
	</tr>
	
	<tr><td>作　　业：</td>
		<td><?= $edit?'<p><input type="button" value="add homework" 
					onclick="add_homework('.$cid.');"></p>':''; ?>
			<?php foreach ($this->homework as $hw) : ?>
			<p><a href="javascript:show_homework(<?=$hw['HId']?>)"><?=$hw['Title']?></a> / 交作业方式：<?=$hw['Deadline']?> / <?=$hw['Teacher']?>
			<?=$edit?' / <input type="button" value="del"
						onclick="del_homework('.$hw['HId'].')" />':''; ?>
			</p>
			<?php endforeach; ?>
		</td>
	</tr>

	</table>


	<div class="clear"></div>
</div> <!-- end of course info -->

<?php include 'frame-bottom.php'; ?>
